/*
* Copyright 2025 NXP
* NXP Proprietary. This software is owned or controlled by NXP and may only be used strictly in
* accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing,
* activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to
* comply with and are bound by, such license terms.  If you do not agree to be bound by the applicable license
* terms, then you may not retain, install, activate or otherwise use the software.
*/

#include "lvgl.h"
#include <stdio.h>
#include "gui_guider.h"
#include "events_init.h"
#include "widgets_init.h"
#include "custom.h"



int home_digital_clock_min_value = 25;
int home_digital_clock_hour_value = 11;
int home_digital_clock_sec_value = 50;
void setup_scr_home(lv_ui *ui)
{
    //Write codes home
    ui->home = lv_obj_create(NULL);
    lv_obj_set_size(ui->home, 480, 480);
    lv_obj_set_scrollbar_mode(ui->home, LV_SCROLLBAR_MODE_OFF);

    //Write style for home, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_bg_opa(ui->home, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(ui->home, lv_color_hex(0x010101), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_dir(ui->home, LV_GRAD_DIR_HOR, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_color(ui->home, lv_color_hex(0x152029), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_main_stop(ui->home, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_stop(ui->home, 233, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_digital_clock
    static bool home_digital_clock_timer_enabled = false;
    ui->home_digital_clock = lv_label_create(ui->home);
    lv_obj_set_pos(ui->home_digital_clock, 35, 63);
    lv_obj_set_size(ui->home_digital_clock, 283, 99);
    lv_label_set_text(ui->home_digital_clock, "11:25:50");
    if (!home_digital_clock_timer_enabled) {
        lv_timer_create(home_digital_clock_timer, 1000, NULL);
        home_digital_clock_timer_enabled = true;
    }

    //Write style for home_digital_clock, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_radius(ui->home_digital_clock, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->home_digital_clock, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->home_digital_clock, &lv_font_Antonio_Regular_92, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->home_digital_clock, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_letter_space(ui->home_digital_clock, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->home_digital_clock, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui->home_digital_clock, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(ui->home_digital_clock, 7, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(ui->home_digital_clock, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(ui->home_digital_clock, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(ui->home_digital_clock, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->home_digital_clock, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_c_sd_kqzl
    ui->home_c_sd_kqzl = lv_obj_create(ui->home);
    lv_obj_set_pos(ui->home_c_sd_kqzl, 41, 240);
    lv_obj_set_size(ui->home_c_sd_kqzl, 334, 35);
    lv_obj_set_scrollbar_mode(ui->home_c_sd_kqzl, LV_SCROLLBAR_MODE_OFF);

    //Write style for home_c_sd_kqzl, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_border_width(ui->home_c_sd_kqzl, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui->home_c_sd_kqzl, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui->home_c_sd_kqzl, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_side(ui->home_c_sd_kqzl, LV_BORDER_SIDE_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->home_c_sd_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui->home_c_sd_kqzl, 25, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(ui->home_c_sd_kqzl, lv_color_hex(0xafafaf), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_dir(ui->home_c_sd_kqzl, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(ui->home_c_sd_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(ui->home_c_sd_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(ui->home_c_sd_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(ui->home_c_sd_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->home_c_sd_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_icon_sd
    ui->home_icon_sd = lv_image_create(ui->home_c_sd_kqzl);
    lv_obj_set_pos(ui->home_icon_sd, 2, 5);
    lv_obj_set_size(ui->home_icon_sd, 31, 25);
    lv_obj_add_flag(ui->home_icon_sd, LV_OBJ_FLAG_CLICKABLE);
    lv_image_set_src(ui->home_icon_sd, &_sd_RGB565A8_31x25);
    lv_image_set_pivot(ui->home_icon_sd, 50,50);
    lv_image_set_rotation(ui->home_icon_sd, 0);

    //Write style for home_icon_sd, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_image_recolor_opa(ui->home_icon_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_image_opa(ui->home_icon_sd, 255, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_label_sd
    ui->home_label_sd = lv_label_create(ui->home_c_sd_kqzl);
    lv_obj_set_pos(ui->home_label_sd, 33, 10);
    lv_obj_set_size(ui->home_label_sd, 34, 17);
    lv_label_set_text(ui->home_label_sd, "湿度");
    lv_label_set_long_mode(ui->home_label_sd, LV_LABEL_LONG_WRAP);

    //Write style for home_label_sd, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_border_width(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->home_label_sd, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->home_label_sd, &lv_font_SourceHanSerifSC_Regular_16, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->home_label_sd, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_letter_space(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_line_space(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->home_label_sd, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->home_label_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_text_sd
    ui->home_text_sd = lv_label_create(ui->home_c_sd_kqzl);
    lv_obj_set_pos(ui->home_text_sd, 66, 11);
    lv_obj_set_size(ui->home_text_sd, 38, 15);
    lv_label_set_text(ui->home_text_sd, " 50%");
    lv_label_set_long_mode(ui->home_text_sd, LV_LABEL_LONG_WRAP);

    //Write style for home_text_sd, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_border_width(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->home_text_sd, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->home_text_sd, &lv_font_Antonio_Regular_16, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->home_text_sd, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_letter_space(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_line_space(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->home_text_sd, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->home_text_sd, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_label_kqzl
    ui->home_label_kqzl = lv_label_create(ui->home_c_sd_kqzl);
    lv_obj_set_pos(ui->home_label_kqzl, 212, 9);
    lv_obj_set_size(ui->home_label_kqzl, 69, 17);
    lv_label_set_text(ui->home_label_kqzl, "空气质量");
    lv_label_set_long_mode(ui->home_label_kqzl, LV_LABEL_LONG_WRAP);

    //Write style for home_label_kqzl, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_border_width(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->home_label_kqzl, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->home_label_kqzl, &lv_font_SourceHanSerifSC_Regular_16, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->home_label_kqzl, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_letter_space(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_line_space(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->home_label_kqzl, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->home_label_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_text_kqzl
    ui->home_text_kqzl = lv_label_create(ui->home_c_sd_kqzl);
    lv_obj_set_pos(ui->home_text_kqzl, 281, 9);
    lv_obj_set_size(ui->home_text_kqzl, 45, 17);
    lv_label_set_text(ui->home_text_kqzl, "100%");
    lv_label_set_long_mode(ui->home_text_kqzl, LV_LABEL_LONG_WRAP);

    //Write style for home_text_kqzl, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_border_width(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->home_text_kqzl, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->home_text_kqzl, &lv_font_montserratMedium_16, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->home_text_kqzl, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_letter_space(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_line_space(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->home_text_kqzl, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->home_text_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_icon_kqzl
    ui->home_icon_kqzl = lv_image_create(ui->home_c_sd_kqzl);
    lv_obj_set_pos(ui->home_icon_kqzl, 189, 7);
    lv_obj_set_size(ui->home_icon_kqzl, 20, 20);
    lv_obj_add_flag(ui->home_icon_kqzl, LV_OBJ_FLAG_CLICKABLE);
    lv_image_set_src(ui->home_icon_kqzl, &_kqzl_RGB565A8_20x20);
    lv_image_set_pivot(ui->home_icon_kqzl, 50,50);
    lv_image_set_rotation(ui->home_icon_kqzl, 0);

    //Write style for home_icon_kqzl, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_image_recolor_opa(ui->home_icon_kqzl, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_image_opa(ui->home_icon_kqzl, 255, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_text_date
    ui->home_text_date = lv_label_create(ui->home);
    lv_obj_set_pos(ui->home_text_date, 41, 189);
    lv_obj_set_size(ui->home_text_date, 184, 29);
    lv_label_set_text(ui->home_text_date, "7月3日  星期四");
    lv_label_set_long_mode(ui->home_text_date, LV_LABEL_LONG_WRAP);

    //Write style for home_text_date, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_border_width(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->home_text_date, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->home_text_date, &lv_font_SourceHanSerifSC_Regular_25, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->home_text_date, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_letter_space(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_line_space(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->home_text_date, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_top(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_right(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_bottom(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_pad_left(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->home_text_date, 0, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_setting
    ui->home_setting = lv_image_create(ui->home);
    lv_obj_set_pos(ui->home_setting, 341, 323);
    lv_obj_set_size(ui->home_setting, 90, 90);
    lv_obj_add_flag(ui->home_setting, LV_OBJ_FLAG_CLICKABLE);
    lv_image_set_src(ui->home_setting, &_setting2_RGB565A8_90x90);
    lv_image_set_pivot(ui->home_setting, 50,50);
    lv_image_set_rotation(ui->home_setting, 0);

    //Write style for home_setting, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_image_recolor_opa(ui->home_setting, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_image_opa(ui->home_setting, 255, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_calendar
    ui->home_calendar = lv_image_create(ui->home);
    lv_obj_set_pos(ui->home_calendar, 191, 318);
    lv_obj_set_size(ui->home_calendar, 100, 100);
    lv_obj_add_flag(ui->home_calendar, LV_OBJ_FLAG_CLICKABLE);
    lv_image_set_src(ui->home_calendar, &_calendar_RGB565A8_100x100);
    lv_image_set_pivot(ui->home_calendar, 50,50);
    lv_image_set_rotation(ui->home_calendar, 0);

    //Write style for home_calendar, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_image_recolor_opa(ui->home_calendar, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_image_opa(ui->home_calendar, 255, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes home_alerm
    ui->home_alerm = lv_image_create(ui->home);
    lv_obj_set_pos(ui->home_alerm, 45, 318);
    lv_obj_set_size(ui->home_alerm, 100, 100);
    lv_obj_add_flag(ui->home_alerm, LV_OBJ_FLAG_CLICKABLE);
    lv_image_set_src(ui->home_alerm, &_nz1_RGB565A8_100x100);
    lv_image_set_pivot(ui->home_alerm, 50,50);
    lv_image_set_rotation(ui->home_alerm, 0);

    //Write style for home_alerm, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_image_recolor_opa(ui->home_alerm, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_image_opa(ui->home_alerm, 255, LV_PART_MAIN|LV_STATE_DEFAULT);

    //The custom code of home.


    //Update current screen layout.
    lv_obj_update_layout(ui->home);

    //Init events for screen.
    events_init_home(ui);
}
